<template>
	<view>
		<view class="top-box">
			<view class="topx">
				<!-- <image src="../../static/无头像.png" mode=""></image> -->
				<!-- {{name.nickName}} -->
				<image :src="count.avatarUrl" mode=""></image>
				<!-- <image :src="img" mode=""></image> -->
			</view>
			<button @click="shouquans()" v-if="flag">微信登陆</button>
			<view v-else='flag' class="conent">{{count.nickName}} (未加入队伍)</view>
		</view>
		<navigator url="/pages/my/ge">
			<view class="lie">
				<view class="ss">
					<image src="../../static/我的资料.png" mode=""></image>
					<view>个人资料</view>
				</view>
				<span>></span>
			</view>
		</navigator>
		<navigator url="/pages/my/duiwu">
			<view class="lie">
				<view class="ss">
					<image src="../../static/同步.png" mode=""></image>
					<view>我的队伍</view>
				</view>
				<span>></span>

			</view>
		</navigator>
		<navigator url="/pages/my/yao">
			<view class="lie">
				<view class="ss">
					<image src="../../static/奖牌.png" mode=""></image>
					<view>邀请好友</view>
				</view>
				<span>></span>
			</view>
		</navigator>

		<view class="lie" @click="pai">
			<view class="ss">
				<image src="../../static/奖杯.png" mode=""></image>
				<view>排行榜</view>
			</view>
			<span>></span>
		</view>
		<navigator url="/pages/my/riqi">
			<view class="lie">
				<view class="ss">
					<image src="../../static/日历.png" mode=""></image>
					<view>新闻资讯</view>
				</view>
				<span>></span>
			</view>
		</navigator>

		<navigator url="/pages/my/shouqaun">
			<view class="lie">
				<view class="ss">
					<image src="../../static/授权.png" mode=""></image>
					<view>授权设置</view>
				</view>
				<span>></span>
			</view>
		</navigator>

		<navigator url="/pages/my/bu">
			<view class="lie">
				<view class="ss">
					<image src="../../static/步数.png" mode=""></image>
					<view>历史步数</view>
				</view>
				<span>></span>
			</view>
		</navigator>

		<view class="lie">
			<view class="ss">
				<image src="../../static/版本号.png" mode=""></image>
				<view>版本号</view>
			</view>
			<span>202211.7 &nbsp; &nbsp; ></span>
		</view>


	</view>
</template>
<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				name: '',
				flag: true
			}
		},
		computed: {
			...mapState({
				count: state => state.crad.count
			})
		},
		onLoad() {
			console.log('我的信息')
		},
		methods: {
			da() {
				uni.switchTab({
					url: '/pages/dati/dati'
				})
			},
			pai() {
				uni.switchTab({
					url: '/pages/list/list'
				})
			},

			shouquans() {
				let that = this
				uni.showModal({
					title: "获取你的用户信息",
					content: "获取你的昵称、头像",
					success(res) {
						if (res.confirm) {
							uni.getUserProfile({
								lang: 'zh_CN',
								desc: true,
								desc: '获取你的昵称、头像',
								success: (res) => {
									console.log(res);
									that.flag = !that.flag;
									uni.showToast({
										title: "授权成功",
									})
									that.name = res.userInfo
									that.name.avatarUrl = "../../static/person1.jpg"
									that.name.nickName = "scbshb"
									that.$store.commit('Minus', that.name)
								}
							})
						}
					}
				})
			},


		}
	}
</script>

<style scoped>
	.top-box {
		width: 100%;
		background-color: #f00;
		height: 300rpx;
		border-radius: 0px 0px 16px 16px;
	}

	.topx {
		width: 70px;
		height: 70px;
		border-radius: 50%;
		background-color: gainsboro;
		margin: 0 auto;
		/* padding-top: 10rpx; */
		box-sizing: border-box;
		background-image: url(../../static/无头像.png);
		background-size: 70px 70px;
		background-image: no-repeat;
	}

	.topx image {
		width: 70px;
		height: 70px;
		display: block;
		margin: 0 auto;
		border-radius: 50%;
	}

	button {
		border: none;
		background-color: #2dbe52;
		width: 33%;
		margin: 0 auto;
		height: 70rpx;
		line-height: 70rpx;
		margin-top: 15rpx;
		color: white;
		font-size: 15px;
	}

	.conent {
		color: white;
		text-align: center;
		margin: 0 auto;
		margin-top: 12px;
	}

	.lie {
		margin: 0 auto;
		margin-top: 20rpx;
		width: 90%;
		height: 70rpx;
		border-bottom: gray 1px solid;
		line-height: 70rpx;
		display: flex;
		justify-content: space-between;
	}

	.ss {
		width: 190rpx;
		display: flex;

	}

	.ss>view {
		color: black;
		font-weight: 600;
		margin-left: 20rpx;
	}

	.lie image {
		display: block;
		width: 20px;
		height: 20px;
		margin-top: 20rpx;
	}

	.lie span {
		display: block;

	}
</style>
